export http_proxy="http://xx.xx.xx.xx:xx"
export https_proxy="http://xx.xx.xx.xx:xx"
export no_proxy=127.0.0.1,.huawei.com,localhost,local,.local

echo "============================================ prepareing megatron code ==========================================="
rm -rf Megatron-LM_last
mv Megatron-LM_now Megatron-LM_last
# cp -rf Megatron-LM0401bk Megatron-LM_last
rm -rf Megatron-LM
git clone https://github.com/NVIDIA/Megatron-LM.git
cp -rf Megatron-LM Megatron-LM_now

if [ ! -d "mg_archive" ];then
    mkdir mg_archive
fi
cp -rf Megatron-LM mg_archive/Megatron-LM_$(date '+%Y%m%d')


echo "============================================ prepareing environment ============================================="
source /root/.bashrc
conda activate mstestpy310


echo "============================================ checking megatron update ==========================================="
dt=$(date '+%Y%m%d')
python check_mgut_update.py Megatron-LM_last Megatron-LM tests/unit_tests "./logs/mg_update/ut_chgs_$dt.txt"
cp -rf ./logs/mg_update/ut_chgs_$dt.txt ./logs/mg_update/ut_chgs.txt
python check_mgut_update.py Megatron-LM_last Megatron-LM megatron "./logs/mg_update/mg_chgs_$dt.txt"
cp -rf ./logs/mg_update/mg_chgs_$dt.txt ./logs/mg_update/mg_chgs.txt
python check_args_update.py Megatron-LM_last Megatron-LM "./logs/mg_update/args_chgs_$dt.txt"
cp -rf ./logs/mg_update/args_chgs_$dt.txt ./logs/mg_update/args_chgs.txt

